package xin.workflow.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.activiti.engine.repository.ProcessDefinition;

import java.io.Serializable;

/**
 * <pre>
 * 流程DTO
 * </pre>
 *
 * @author lixin_ma@outlook.com
 * @version 1.0
 * @since 2018/12/19
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ProcessDto implements Serializable {
    String id;

    String category;

    String name;

    String key;

    String description;

    int version;

    String resourceName;

    String deploymentId;

    String diagramResourceName;

    boolean startFormKey;

    boolean graphicalNotation;

    boolean suspended;

    String tenantId;

    public ProcessDto(ProcessDefinition definition) {
        this.setId(definition.getId());
        this.setCategory(definition.getCategory());
        this.setName(definition.getName());
        this.setKey(definition.getKey());
        this.setDescription(definition.getDescription());
        this.setVersion(definition.getVersion());
        this.setResourceName(definition.getResourceName());
        this.setDeploymentId(definition.getDeploymentId());
        this.setDiagramResourceName(definition.getDiagramResourceName());
        this.setStartFormKey(definition.hasStartFormKey());
        this.setGraphicalNotation(definition.hasGraphicalNotation());
        this.setSuspended(definition.isSuspended());
        this.setTenantId(definition.getTenantId());
    }
}
